package dongshi.daddy.main;

import dongshi.daddy.service.ProviderAnotherService;
import dongshi.daddy.service.ProviderService;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class ConsumerWithMultiServiceMain {
    public static void main(String[] args) throws Exception {
        try {
//            System.setProperty("owner", "还有2个月过年");
            ClassPathXmlApplicationContext context
                    = new ClassPathXmlApplicationContext("consumer-with-multi-service.xml");
            context.start();
            ProviderService providerService = (ProviderService) context.getBean("providerService");
            System.out.println(providerService.SayHello("hello"));
            ProviderAnotherService anotherService = context.getBean("anotherService", ProviderAnotherService.class);
            System.out.println(anotherService.SayHelloAnother("hellooo"));
            System.in.read();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
